package de.hauschild.orbitvm.vm.instruction.impl.dooble;

public class Div extends AbstractDoubleInstruction {

  public Div(final int theInstructionCounter, final int theFirstArgumentAdress, final int theSecondArgumentAdress) {
    super(theInstructionCounter, theFirstArgumentAdress, theSecondArgumentAdress);
  }

  @Override
  public String getName() {
    return "Div";
  }

  @Override
  protected double evaluate(final double firstArgument, final double secondArgument) {
    if (secondArgument == 0.0) {
      return 0.0;
    }
    return firstArgument / secondArgument;
  }

}
